Replication Instructions
========================
Paper: The Rule of Law, Collective Action, and Growth: Micro Evidence from Peru
Authors: Keefer, Espinoza, Espinoza, Fort
Journal: Economic Development and Cultural Change (2025)

FOLDER STRUCTURE
-----------------
KEEF25/
├── code/
│   ├── 0. main.do
│   ├── 1. descriptives.do
│   ├── 2. analyses.do
│   └── 3. appendix.do
├── data/
│   ├── Bcom_976total_2022.dta
│   ├── Bmdo_90total_2022.dta
└── output/
    ├── tab/     ← tables outputed here
    └── fig/     ← figures outputed here

HOW TO RUN THE CODE
--------------------
Simply run the master script:

    do "code/0. master.do"

This script:
1. Sets global paths. (ACTION REQUIRED)
2. Defines control variables.
3. Sequentially runs:
   - 1. descriptives.do – Tables 1–3
   - 2. analyses.do – Tables 4–8, A1, and Figure 2
   - 3. appendix.do – Tables A2–A4
Use StataNow (Stata 19) to ensure compatibility.

DEPENDENCIES
------------
Ensure the following Stata packages are installed (uncomment in 0. main.do if needed):

    ssc install parmest, replace
    ssc install ivreg2, replace
    ssc install ranktest, replace
    ssc install texdoc, replace

DATA FLOW AND INTERMEDIATE FILES
--------------------------------
Input Datasets:
- Bcom_976total_2022.dta: Vendor-level data
- Bmdo_90total_2022.dta: Market-level data

Intermediate Steps:
- Variables like `enf_form_ind` (individual-level enforcement) and `vecFIN` (social ties) are constructed from raw survey responses.
- Merges between vendor and market datasets are conducted.

Outputs:
- Tables are exported as `.tex` files to `output/tab/`
- Figure 2 is saved as `.pdf` in `output/fig/`

1. descriptives.do
- Table 1: Enforcement Practices in Markets with Strong and Weak Social Ties. 	→ "tabla1_enforcement.tex"
- Table 2: Summary Statistics. 							→ "tabla2_sumstats.tex"
- Table 3: Balance Table, Markets With and Without Strong Social Ties. 		→ "tabla3_balance.tex"

2. analyses.do
- Table 4: Formal Enforcement of Rules and Collective Action: All Board Enforcement Action. 			→ "tabla4_vendor_comp.tex"
- Table A1: Formal Enforcement of Rules and Collective Action: IV Second Stage With All Controls. 		→ "tablaA1_vendor_comp.tex"
- Table 5: Formal Enforcement of Rules and Other Collective Action Measures. 					→ "tabla5_vendor_comp.tex"
- Table 6: Alternative Measures of Enforcement. 								→ "tabla6_strictboard.tex"
- Table 7: Formal Enforcement of Rules and Collective Action: Robustness of Origin Settlement Size Criterion. 	→ "tabla7_settlement.tex"
- Table 8: Formal Enforcement of Norms and growth in Number of Customers, 2007-2017. 				→ "tabla8_vendor_comp.tex"
- Figure: 													→ "figure2.pdf"

3. appendix.do
- Appendix Table A2:Trust and Public Goods Games. 											→ "tablaA2_games.tex"
- Appendix Table A3: Formal Enforcement of Rules and Collective Action: All Board Enforcement Actions (Regressions at the Market Level) → "tablaA3_market.tex"
- Appendix Table A4: Formal Enforcement of Rules and Collective Action: All Board Enforcement Actions (Enforcement at the Vendor Level) → "tablaA4_vendor.tex"

CONTACT
-------
For questions or issues with replication, please contact the authors:
- Keefer: pkeefer@iadb.org
- Espinoza (Mauricio): mespinoza@grade.org.pe
- Espinoza (Alvaro): aespinoza@grade.org.pe
- Fort: rfort@grade.org.pe
